public class ThermostaticWaterTank {
    private boolean isHeating;
    private double temperature;
    private boolean isWaterAvailable;
    private boolean isBurntOut;
    private boolean isSleeping;

    public ThermostaticWaterTank() {
        this.isHeating = false;
        this.temperature = 20.0;
        this.isWaterAvailable = true; // 假设初始时水箱有水
        this.isBurntOut = false;
        this.isSleeping = false;
    }

    public void checkTemperature(double currentTemperature) {
        this.temperature = currentTemperature;

        if (this.isSleeping) {
            if (isMorning()) {
                this.isSleeping = false;
                startHeatingProcess();
            }
        } else {
            if (this.temperature < 20.0 && this.isWaterAvailable && !this.isBurntOut) {
                this.isHeating = true;
                System.out.println("Heating started.");
            } else if (this.temperature >= 100.0) {
                this.isHeating = false;
                System.out.println("Heating stopped, temperature reached 100°C.");
            } else if (this.isBurntOut) {
                System.out.println("Tank burnt out, needs repair.");
            }
        }
    }

    public void checkWaterAvailability(boolean isWaterAvailable) {
        this.isWaterAvailable = isWaterAvailable;
        if (!this.isWaterAvailable && this.temperature < 20.0) {
            System.out.println("No water available, heating not started.");
        }
    }

    private void startHeatingProcess() {
        if (this.isWaterAvailable && !this.isBurntOut) {
            this.isHeating = true;
        } else {
            this.isHeating = false;
        }
    }

    public void setBurntOut(boolean isBurntOut) {
        this.isBurntOut = isBurntOut;
    }

    public void setSleeping(boolean isSleeping) {
        this.isSleeping = isSleeping;
    }

    private boolean isMorning() {
        // 这里简化处理，实际应用中应根据系统时间判断
        return true;
    }

    public static void main(String[] args) {
        ThermostaticWaterTank tank = new ThermostaticWaterTank();
        tank.checkTemperature(15.0); // 低于20°C，应开始加热
        tank.checkWaterAvailability(false); // 假设无水，不应加热
        tank.checkWaterAvailability(true); // 假设有水，应开始加热
        tank.checkTemperature(105.0); // 超过100°C，应停止加热
        tank.setBurntOut(true); // 水箱烧坏，需要维修
        tank.setSleeping(true); // 晚上11点，进入休眠状态
    }
}